AtomicPart = Angel01.extend({
	doing:false,
	openAction:null,
	status:0,
	ctor:function (parent,fileName, rect, rotated) {
		this._super(fileName, rect, rotated);
		parent.addChild(this, 20, TAG_ATOMIC_PART);
	},
	initAtomicPart:function (){
		var diffX = 25;
		var diffY = 50;
		var x = this.x+this.parent.x + diffX;
		var y = this.y+this.parent.y + diffY;
		var w = this.width - diffX;
		var h = this.height - diffY;
		this.openRect = new cc.rect(x, y, w, h);
		this.closeRect = new cc.rect(x - diffX,y - diffY, w, h);
		this.diyRect = this.openRect;
		
		var animFrames = [];
		for (var i = 1; i < 5; i++) {
			var str = "atomic_part" + i + ".png";
			var frame = cc.spriteFrameCache.getSpriteFrame(str);
			animFrames.push(frame);
		}
		var animation = new cc.Animation(animFrames, 0.2);
		this.openAction = new cc.Repeat(cc.Animate.create(animation), 1);
		this.openAction.retain();// jsb BUG
		this.closeAction = this.openAction.reverse();
		this.closeAction.retain();
	},
	open:function(teach_flow){
		this.status = 1;
		this.diyRect = this.closeRect;
		cc.log(teach_flow);
		this.runAction(cc.sequence(
				this.openAction,
				cc.callFunc(this.checkActionDone, this, teach_flow)));
		this.openAction.release();
	},
	close:function(teach_flow){
		this.status = 0;
		this.runAction(cc.sequence(this.closeAction,cc.callFunc(this.checkActionDone, this, teach_flow)));
		this.closeAction.release();
	},
	checkActionDone:function(data,teach_flow){
		if(this.status == 1 && this.openAction.isDone()){
			teach_flow.next();
		} else if(this.status == 0 &&this.closeAction.isDone()){
			teach_flow.next();
			this.parent.setVisible(false);
			this.parent.getParent().atomic2.setVisible(true);
		}
	}
});